package com.cyandpos.pad.pay.presenter;


import com.cyandpos.pad.activity.PayActivity;
import com.cyandpos.pad.pay.model.ICustomerPaymentModel;
import com.cyandpos.pad.pay.model.ICustomerPaymentModelImpl;
import com.cyandpos.pad.pay.view.ICustomerPaymentView;

/**
 * 顾客付款Presenter
 */

public class CustomerPaymentPresenter {
    ICustomerPaymentView mPayListView;
    ICustomerPaymentModel payListModel ;
    private int mSelectedPmtId;
    private int mCurrentPay;
    private int mPayType;
    private PayActivity mPayAct;

    //通过构造方法实例化mGirlView
    public CustomerPaymentPresenter(ICustomerPaymentView payListView, int selectedPmtId, int payType, int currentPay)
    {
        this.mPayListView = payListView;
        this.mPayAct = (PayActivity) payListView;
        this.mCurrentPay = currentPay;
        this.mSelectedPmtId = selectedPmtId;
        this.mPayType = payType;
        payListModel = new ICustomerPaymentModelImpl();
    }

    public void addCustomerPayment(){
        if(payListModel!=null){
            payListModel.loadPayList(mSelectedPmtId,mPayType,mCurrentPay,mPayAct,new ICustomerPaymentModel.PayListOnLoadListener(){

                @Override
                public void onAddPaymentComplete() {
                    mPayListView.updateCustomerPaymentList();
                }
            });
        }
    }
}
